package server.business.login.handler;

import com.core.initialize.Message;
import com.google.protobuf.GeneratedMessage;

import server.ServerEngin;
import server.ServerHandler;
import server.ServerTransportProxy;
import server.commonData.User;
import server.messageId.S2CMessageId;
import server.msgBean.LoginMessage.RankingListReq;

/**
 * 排行榜数据请求
 * @author King
 *
 */
public class RankingListHandler extends ServerHandler {

	@Override
	public Class<? extends GeneratedMessage> initBodyClass() {
		return RankingListReq.class;
	}

	@Override
	protected void handler(Message msg, User user) throws Throwable
	{
		RankingListReq req= msg.getBody();
		msg.clearDate();
		msg.setModuleAction(S2CMessageId.Login.MODULE_ID, S2CMessageId.Login.RANKING_LIST_RES);
		msg.setBody(ServerEngin.getInstance().getCache().getRankingManager().toClient(req.getType()));
		ServerTransportProxy.sendMsg(msg, user);
	}

}
